<template>
	<view>
		
		<!-- <view class="sm">
			免责声明:本平台发布的所有信息展示，内容本身与平台本身无关，平台不负任何责任。
		</view> -->
		<u-loading-page icon-size="100rpx" :loading="loading" loading-text="驼乡生活信息超市"></u-loading-page>
		<view class="" v-if="!loading">
			<navbar :isback="true" :title="'审核'+title"></navbar>
			<u--form labelPosition="left" :model="model1" ref="uForm" labelWidth='200rpx'
				:labelStyle='{fontWeight: 500,fontSize: "28rpx",color: "#000000",}'>
				<u-form-item label="昵称" prop="userInfo.contract" leftIcon='/static/msg/nickname.png'
					leftIconStyle="width:33rpx;height:46rpx;margin-right:29rpx;" borderBottom ref="item1">
					<u--input v-model="model1.userInfo.contract" border="none" fontSize="28rpx" color='#000000'
						placeholder='请填写联系人昵称' placeholderStyle='color:#686767;font-size:28rpx;' inputAlign='right' disabled
						disabledColor='#fff'> </u--input>
			
				</u-form-item>
				<u-form-item label="手机号" prop="userInfo.phone" leftIcon='/static/msg/phone.png'
					leftIconStyle="width:37rpx;height:42rpx;margin-right:26rpx;" borderBottom ref="item1">
					<u--input v-model="model1.userInfo.phone" border="none" fontSize="28rpx" color='#000000'
						placeholder='请填写联系人手机号' placeholderStyle='color:#686767;font-size:28rpx;' inputAlign='right'
						disabled disabledColor='#fff'></u--input>
			
				</u-form-item>
				<u-form-item label="地址" prop="userInfo.address" leftIcon='/static/msg/addr.png'
					leftIconStyle="width:35rpx;height:42rpx;margin-right:27rpx;" borderBottom ref="item1">
					<u--input v-model="model1.userInfo.address" border="none" fontSize="28rpx" color='#000000'
						placeholder='请填写店铺详细地址' placeholderStyle='color:#686767;font-size:28rpx;' inputAlign='right'
						disabled disabledColor='#fff'></u--input>
			
				</u-form-item>
				<u-form-item label="发布类型" prop="userInfo.type" borderBottom ref="item1">
					<u--input v-model="type" border="none" fontSize="28rpx" color='#000000' placeholder=''
						placeholderStyle='color:#686767;font-size:28rpx;' inputAlign='right' disabled
						disabledColor='#fff'></u--input>
			
				</u-form-item>
				<u-form-item label="是否优惠发布" prop="userInfo.short_type" borderBottom ref="item1">
					<u--input v-model="short_type" border="none" fontSize="28rpx" color='#000000' placeholder=''
						placeholderStyle='color:#686767;font-size:28rpx;' inputAlign='right' disabled
						disabledColor='#fff'></u--input>
			
				</u-form-item>
				<u-form-item label="发布天数" prop="userInfo.project_id" borderBottom ref="item1">
					<u--input v-model="projecttime" border="none" fontSize="28rpx" color='#000000' placeholder=''
						placeholderStyle='color:#686767;font-size:28rpx;' inputAlign='right' disabled
						disabledColor='#fff'></u--input>
			
				</u-form-item>
				<u-form-item label="失败原因" v-if="model1.userInfo.remark" prop="userInfo.remark" borderBottom ref="item1">
					<!-- <u--input v-model="model1.userInfo.remark" border="none" fontSize="28rpx" color='#000000' placeholder=''
						placeholderStyle='color:#686767;font-size:28rpx;' inputAlign='right' disabled
						disabledColor='#fff'></u--input> -->
					<view class="">
						{{model1.userInfo.remark}}
					</view>
				</u-form-item>
				<u-gap bgColor="#FAFAFA" height="20rpx"></u-gap>
				<u-form-item labelPosition='top' prop="userInfo.text" borderBottom ref="item1">
					<view class="">
						{{model1.userInfo.text}}
					</view>
				</u-form-item>
			
			</u--form>
			<view class="con">
				<!-- 上传 -->
				<view class="u-flex u-flex-y-center u-flex-between" v-if='model1.userInfo.card_images'>
					<view class="con__title u-flex u-flex-y-center">
						<view class="con__title__line">
			
						</view>
						证件照片
					</view>
				</view>
				<view class="u-flex" v-if='model1.userInfo.card_images'>
					<view class="upbox" v-if="card_imageslist[0]" @click="preview([URL(card_imageslist[0])],0)">
			
						<image style="width: 164rpx;height: 164rpx;" :src="URL(card_imageslist[0])" mode="aspectFill">
						</image>
						营业执照
					</view>
					<view class="upbox" v-if="card_imageslist[1]" @click="preview([URL(card_imageslist[1])],1)">
			
						<image style="width: 164rpx;height: 164rpx;" :src="URL(card_imageslist[1])" mode="aspectFill">
						</image>
						身份证
					</view>
				</view>
				<view class="u-flex u-flex-y-center u-flex-between" v-if="ad_imageslist.length>0">
					<view class="con__title u-flex u-flex-y-center">
						<view class="con__title__line">
			
						</view>
						广告照片
					</view>
				</view>
				<view class="u-flex u-flex-wrap">
					<view class="upbox" style="margin-bottom: 20rpx;" v-for="(item,index) in ad_imageslist" :key="index"
						@click="preview([URL(item)],0)">
						<view class="cha" @click.stop="del('ad_imageslist',index)">
							<u-icon name="/static/my/cha.png" size="20rpx"></u-icon>
						</view>
						<image style="width: 164rpx;height: 164rpx;" :src="URL(item)" mode="aspectFill"></image>
					</view>
				</view>
				<u-gap height="34rpx"></u-gap>
			
			</view>
			<!-- 发布选项 -->
			<view class="footer">
				<view class="u-flex u-flex-y-center" v-if="model1.userInfo.status==1">
					<view class="" @click.stop="clickbtn(1)">
						<u-button text="拒绝通过" color="linear-gradient(90deg, #0484FC, #5D77FC)"
							:customStyle="{width:'300rpx',height:'100rpx'}" shape='circle'></u-button>
					</view>
					<view class="" @click.stop="clickbtn(2)" style="margin-left: 26rpx;">
						<u-button text="通过审核" color="linear-gradient(156deg, #03EA7A, #02C683)"
							:customStyle="{width:'300rpx',height:'100rpx'}" shape='circle'></u-button>
					</view>
				</view>
				<view class="u-flex u-flex-y-center" v-if="model1.userInfo.status==2">
					<u-button text="已通过审核" color="linear-gradient(156deg, #03EA7A, #02C683)" :customStyle="{height:'100rpx'}" shape='circle'></u-button>
				</view>
				<view class="u-flex u-flex-y-center" v-if="model1.userInfo.status==4">
					<u-button text="已拒绝通过" color="linear-gradient(90deg, #0484FC, #5D77FC)" :customStyle="{height:'100rpx'}" shape='circle'></u-button>
				</view>
			</view>
			
			
		</view>
		
		<!-- 拒绝弹框 -->
		<u-popup mode="center" :show="show" round="30rpx" @close="show=false" bgColor='transparent'>
			<view class="popbox">
				<view class="popbox__title">
					<text class="popbox__title__xing">*</text>拒绝原因<text class="popbox__title__xing">*</text>
				</view>
				<u-textarea v-model="value1" placeholder="请输入拒绝理由" height='210rpx'
					:placeholderStyle='{color:"#5C5C5C",fontSize:"24rpx",}' border='none'></u-textarea>
				<view class="popbox__footer">
					<u-button @click="submit" text="确认" color="linear-gradient(156deg, #0484FC, #5D77FC)" size="large"
						:customStyle="{height:'93rpx'}" shape='circle'></u-button>
				</view>
			</view>
		</u-popup>
		
	</view>
</template>

<script>
	import home from '@/api/_home'
	import {
		BASE_URL
	} from '@/api/config';
	export default {
		data() {
			return {
				loading:true,
				wechatImage: '',
				jtpic: [],
				showlist: false,
				show: false,
				oldindex: null,
				isgx: false,
				ad_imageslist: [],
				card_imageslist: [],
				curindex: null,
				list: [],
				title: '',
				model1: {
					userInfo: {},
				},
				short_type: '',
				project_id: '',
				type: '',
				proid: '',
				projecttime: '',
				value1: ''
			};
		},
		onLoad(o) {
			this.title = o.title
			this.proid = o.pid
			this.getdetail()
		},
		methods: {
			getdetail() {
				home.infoDetailNoIncView({
					id: this.proid
				}).then(res => {
					if (res.data.code == 1) {
						let data = res.data.data
						this.model1.userInfo = res.data.data
						this.card_imageslist = this.model1.userInfo.card_images.split(',')
						this.ad_imageslist = this.model1.userInfo.ad_images.split(',')
						if (!this.model1.userInfo.ad_images) {
							this.ad_imageslist = []
						}
						if (res.data.data.is_other == 2) {
							this.title = '其他信息'
						}
						// 1=发布,2=置顶,3=其他发布
						if (data.type == 1) {
							this.type = '发布'
						}
						if (data.type == 2) {
							this.type = '置顶'
						}
						if (data.type == 3) {
							this.type = '其他发布'
						}
						// 其他类型:1=普通发布,2=优惠发布
						if (data.short_type == 1) {
							this.short_type = '否'
						} else {
							this.short_type = '是'
						}
						this.getprojectList()
					}
				})
			},
			getprojectList() {
				home.projectList({
					type: this.model1.userInfo.type
				}).then(res => {
					if (res.data.code == 1) {
						this.list = res.data.data
						this.loading=false
						this.list.map(t => {
							if (t.id == this.model1.userInfo.project_id) {
								this.projecttime = t.name
							}
						})
					}
				})
			},
			clickbtn(type) {
				if (type == 1) { //拒绝
					this.show = true
				}
				if (type == 2) { //通过
					home.changeStatus({
						status: 2,
						id: this.model1.userInfo.id
					}).then(res => {
						if (res.data.code == 1) {
							uni.navigateBack()
						}
					})
				}
			},
			submit() {
				if (!this.value1) {
					uni.$u.toast('请输入拒绝理由')
					return
				}
				home.changeStatus({
					status: 4,
					id: this.model1.userInfo.id,
					remark: this.value1
				}).then(res => {
					if (res.data.code == 1) {
						this.show = false
						uni.navigateBack()
					}
				})
			},
		}
	}
</script>

<style lang="scss">
	.sm {
		padding: 18rpx 30rpx;
		background: #FAFAFA;
		font-family: PingFang SC;
		font-weight: 500;
		font-size: 24rpx;
		color: #010101;
		line-height: 36rpx;
	}

	.formitem {}

	/deep/.uni-textarea-placeholder {
		color: #686767 !important;
		font-size: 28rpx !important;
	}

	.con {
		padding: 0 28rpx;

		&__title {
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 32rpx;
			color: #0F1014;
			line-height: 32rpx;
			padding: 50rpx 0 36rpx;

			&__line {
				width: 8rpx;
				height: 27rpx;
				background: #1B64F9;
				border-radius: 4rpx;
				margin-right: 8rpx;
			}
		}

		&__titletip {
			font-family: PingFang SC;
			font-weight: 500;
			font-size: 26rpx;
			color: #1E1E1E;
			line-height: 26rpx;
			opacity: 0.8;
		}
	}

	.upbox {
		width: 164rpx;
		height: 164rpx;
		background: #F5F6FA;
		border-radius: 20rpx;
		display: flex;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		font-family: PingFang SC;
		font-weight: 500;
		font-size: 24rpx;
		color: #101014;
		line-height: 24rpx;
		margin-right: 20rpx;
		position: relative;
		overflow: hidden;

		.cha {
			padding: 6rpx;
			background-color: rgba(0, 0, 0, .8);
			position: absolute;
			top: 4rpx;
			right: 4rpx;
			border-radius: 20rpx;
			z-index: 2;
		}

		&__pic {
			width: 54rpx;
			height: 54rpx;
			margin-bottom: 18rpx;
		}
	}

	.ts {
		display: flex;
		align-items: center;
		height: 101rpx;
		background: #F5F6FA;
		border-radius: 20rpx;
		padding: 0 48rpx;
		font-family: PingFang SC;
		font-weight: bold;
		font-size: 24rpx;
		color: #1B64F9;
		line-height: 24rpx;
		margin: 26rpx 0 36rpx;
	}

	.timelist {
		display: flex;
		align-items: center;
		padding-left: 30rpx;
		flex-wrap: wrap;

		&__item {
			width: 206rpx;
			background: #FFFFFF;
			border-radius: 20rpx;
			border: 4rpx solid #EDEEF3;
			display: flex;
			flex-direction: column;
			align-items: center;
			padding: 0 0 24rpx 0;
			position: relative;
			margin-right: 20rpx;
			margin-bottom: 20rpx;

			&__time {
				padding: 0 10rpx;
				height: 47rpx;
				background: #9A9A9A;
				border-radius: 15rpx 0rpx 15rpx 0rpx;
				position: absolute;
				left: 0;
				top: 0;
				font-family: PingFang SC;
				font-weight: 800;
				font-size: 20rpx;
				color: #FFFFFF;
				line-height: 47rpx;
			}

			&__price {
				font-family: PingFang SC;
				font-weight: 800;
				font-size: 32rpx;
				color: #F9691B;
				line-height: 32rpx;
				padding: 24rpx 0 14rpx;

			}

		}

		.active {
			border-color: #0199FE;
		}
	}

	.checkbox {
		width: 28rpx;
		height: 28rpx;
		margin-right: 10rpx;
		display: flex;
		align-items: center;
		justify-content: center;

		&__icon {
			width: 28rpx;
			height: 28rpx;
		}
	}

	.checkboxlabel {
		font-family: PingFang SC;
		font-weight: bold;
		font-size: 24rpx;
		color: #1D1C1C;
		line-height: 24rpx;
	}

	.footer {
		padding: 52rpx 50rpx 58rpx;

	}

	/deep/.u-form-item {
		padding-left: 28rpx;


	}

	/deep/.u-form-item__body {
		padding: 35rpx 30rpx 35rpx 0 !important;
	}

	/deep/.uni-system-preview-image {
		z-index: 111116 !important;
	}
	/deep/.u-textarea {
		background-color: #F5F1F1 !important;
		border-radius: 30rpx !important;
		padding: 20rpx 30rpx !important;
		font-family: PingFang SC !important;
		font-weight: 500 !important;
		font-size: 24rpx !important;
		color: #333 !important;
		line-height: 36rpx !important;

	}

	/deep/.u-textarea__field {
		font-family: PingFang SC !important;
		font-weight: 500 !important;
		font-size: 24rpx !important;
		color: #333 !important;
		line-height: 36rpx !important;
	}

	.popbox{
		width: 480rpx;
		background-color: #fff;
		border-radius: 30rpx;
		padding: 40rpx 30rpx;
		&__title{
			font-family: PingFang SC;
			font-weight: 500;
			font-size: 28rpx;
			line-height: 28rpx;
			color: #202020;
			text-align: center;
			padding: 8rpx 0 38rpx;
			&__xing{
				color: #0484FC;
				font-size: 30rpx;
			}
		}
		&__footer{
			padding: 36rpx 34rpx 0;
		}
	}
</style>